package mips.instructions.fpu;

import mips.instructions.Instruction;

/**
 * <code>BC1</code> instruction type handler<br/>
 * @author jnmartin84@gmail.com
 */
public class BC1 extends Instruction {

	private static final BC1 INSTANCE = new BC1();
	private static final String INSTRUCTION_NAME = "BC1";

	private BC1(){}

	public static final BC1 getInstance() {
		return INSTANCE;
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public final void execute(int instruction) throws Exception {
		
		//(_ND_ << 1) | _TF_ -- check this?
		
		Instruction.getBc1((Instruction.ND(instruction) << 1) | Instruction.TF(instruction)).execute(instruction);
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public final String emit(final int instruction) {
		return Instruction.getBc1((Instruction.ND(instruction) << 1) | Instruction.TF(instruction)).emit(instruction);
	}
	
	/**
	 * {@inheritDoc}
	 */
	@Override
	public final String getName(final int instruction) {
		return Instruction.getBc1((Instruction.ND(instruction) << 1) | Instruction.TF(instruction)).getName(instruction);
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public final String getName() {
		return INSTRUCTION_NAME;
	}
}